#ifndef FIR_H_
#define FIR_H_

#include "arm_math.h"

// Window types
static const char RECTANGULAR		  	= 0;// Rectangular window function
static const char BARTLETT			  	= 1;// Bartlett (triangular) window
static const char HANNING						= 2;// Hanning window
static const char HAMMING						= 3;// Hamming window
static const char BLACKMAN					= 4;// Blackman window
static const char BLACKMAN_HARRIS		= 5;// Blackman-Harris window
static const char BLACKMAN_NUTTAL		= 6;// Blackman-Nuttal window
static const char NUTTAL						= 7;// Nuttal window
// Filter type
static const char OFF				= 0;
static const char LOWPASS 	= 1;
static const char HIGHPASS	= 2;
static const char BANDSTOP	= 3;
static const char BANDPASS	= 4;


typedef struct {
	char type;
	char window;
	uint16_t numTaps;
	q15_t *coef;
} FIR;
	
double	getWindow	(int i, int n, char window );
// f1 - nizhnaya chastota sreza
// f2 - verhnaya chastota sreza
// v LOWPASS i HIGHPASS filtrah f1==f2
void FirInit	(FIR *fir, char type, char window, short numTaps, int f1, int f2, int sampleRate);
void FirFree (FIR *fir);
void NormalizeCoefs(FIR *fir, double *coef);
#endif
